<%--
  Created by IntelliJ IDEA.
  User: yjhan
  Date: 2014. 7. 9.
  Time: 오전 9:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page session="true"%>
<html>
<head>
    <title>${title}</title>
</head>
<body>
    <h1>${message}</h1>

    <c:url value="/j_spring_security_logout" var="logoutUrl" />

    <form action="${logoutUrl}" method="post" id="logoutForm" />

    <script>
        function formSubmit() {
            document.getElementById("logoutForm").submit();
        }
    </script>

    <c:if test="${pageContext.request.userPrincipal.name != null}">
        <h3>로그인하면 이부분이 보이는건가</h3>
        <h2>
            Welcome : ${pageContext.request.userPrincipal.name} |
            <a href="javascript:formSubmit()"> Logout </a>
        </h2>
    </c:if>
</body>
</html>